package org.biubiu0002.baiblog.core.controller;

import org.biubiu0002.baiblog.common.utils.R;
import org.biubiu0002.baiblog.core.annotations.PermissionIgnore;
import org.biubiu0002.baiblog.core.model.entity.GroupInfoEntity;
import org.biubiu0002.baiblog.core.model.vo.req.GroupInfoReqVo;
import org.biubiu0002.baiblog.core.model.vo.res.GroupInfoResVo;
import org.biubiu0002.baiblog.core.service.GroupInfoService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author: biubiu0002
 * @Date: 2022/12/8 14:13
 **/
@RestController
@RequestMapping("/groupInfo")
public class GroupInfoController {

    @Resource
    private GroupInfoService groupInfoService;

    @PostMapping("/save")
    @PermissionIgnore
    public R saveGroup(){
        GroupInfoEntity groupInfoEntity =  groupInfoService.saveGroup();
        return R.ok().put("data",groupInfoEntity);
    }

    @GetMapping("/{uid}")
    @PermissionIgnore
    public R info(@PathVariable("uid")String uid){
        GroupInfoResVo groupInfoResVo = groupInfoService.getGroupInfo(uid);
        return R.ok().put("data",groupInfoResVo);
    }

    @PostMapping("/{uid}/update")
    @PermissionIgnore
    public R update(@PathVariable("uid")String uid, @RequestBody GroupInfoReqVo groupInfoReqVo){
        return R.ok();
    }


}
